var base = require('./base');

const User_Schema = new base.Schema({
    nickname: {　// 微信名
        type:String
    },
    account: {  // 学号
        type:String
    },
    password: { // 密码
        type:String
    },
    openid: {   
        type:String
    },
    avatarUrl: {    //　头像
        type:String
    },
    course: {　　　　// 课程json
        type:base.Mixed
    },
    cet_46: {       // cet46成绩
        type:base.Mixed
    },
    createTime: {
        type: Date,
        default: Date.now
    },
    updateTime: {
        type: Date,
        default: Date.now
    } 
}, {
    versionKey: false,
    timestamps: { createdAt: 'createTime', updatedAt: 'updateTime' }
});

User_Schema.index({account:1, openid:1})

var User = base.mongoose.model('User', User_Schema);

module.exports = User;